import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
      
    let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
    let channel = FlutterMethodChannel(
      name: "flavor", binaryMessenger: controller.binaryMessenger
    )
      
    channel.setMethodCallHandler({(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
      switch call.method {
        case "getFlavor":
          let flavor = Bundle.main.infoDictionary?["Flavor"]
          result(flavor)
          break
        default:
          result(FlutterMethodNotImplemented);
      }
    })
      
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}
